<template>
  <view> </view>
</template>

<script>
export default {
    data() {
        return {
            pid: '',
        }
    },
    onLoad(options) {
        let queryId = options.person_id
        this.pid = queryId
    },

    onShow() {
        var personId = uni.getStorageSync("person-id").slice(2) || undefined;
        if(!personId) {
            let fullPath = getCurrentPages()[getCurrentPages().length-1].$page.fullPath;
            let returnUrl = encodeURIComponent(fullPath);
            uni.reLaunch({
                url: '/pagesSub/public/loginMode/index?returnUrl='+returnUrl,
            })
            return
        }
        if (this.pid && this.pid != personId) {
            let fullPath = getCurrentPages()[getCurrentPages().length-1].$page.fullPath;
            let returnUrl = encodeURIComponent(fullPath);
            uni.showModal({
                title: "温馨提醒",
                content: "当前账号不一致,请重新登录",
                success: (res) => {
                    if (res.confirm) {
                        uni.reLaunch({
                            url: '/pagesSub/public/loginMode/index?returnUrl='+returnUrl,
                        })
                    } else {
                        uni.redirectTo({
                            url: "/pagesSub/userCenter/enclosure/index",
                        });
                    }
                },
            });
        } else {
            uni.redirectTo({
                url: "/pagesSub/userCenter/enclosure/index",
            });
        }
        
    },
};
</script>

<style>
</style>